package com.jf.springmvc.rest;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.awt.print.Book;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-10-30
 * Time:22:30
 */
@RequestMapping("/book")
@Controller
public class BookHandler {
    @GetMapping("/retrieve/{id}")
    public String retrieveBook(@PathVariable("id") String id) {
        System.out.println("book id = " + id);
        return "success";
    }
    @PostMapping(value = "/create",params = "name")
    public String createBook(@RequestParam("name") String name) {
        System.out.println("create book name = " + name);
        return "success";
    }
    @PutMapping("/update/{id}")
    public String updateBook(@PathVariable("id") String id) {
        System.out.println("update book id = " + id);
        return "redirect:/book/success";
    }
    @DeleteMapping("/delete/{id}")
    public String deleteBook(@PathVariable("id") String id) {
        System.out.println("delete book id = " + id);
        return "redirect:/book/success";
    }
    @RequestMapping("/success")
    public String success() {
        return "success";
    }
}
